#include<stdio.h>

// 可以用比特位标志不同的宏定义，如下所示：
#define PRINT_A 0x1   //0000 0001
#define PRINT_B 0x2   //0000 0010
#define PRINT_C 0x4   //0000 0100
#define PRINT_D 0x8   //0000 1000
#define PRINT_DEF 0x0 

void Show(int flags)
{
    if(flags & PRINT_A) printf("A\n");
    if(flags & PRINT_B) printf("B\n");
    if(flags & PRINT_C) printf("C\n");
    if(flags & PRINT_D) printf("D\n");
    if(flags == PRINT_DEF) printf("Default\n");
}

int main()
{
    printf("PRINT_DEF:\n");
    Show(PRINT_DEF);
    printf("PRINT_A:\n");
    Show(PRINT_A);
    printf("PRINT_B:\n");
    Show(PRINT_B);
    printf("PRINT_A and PRINT_B:\n");
    Show(PRINT_A | PRINT_B);
    printf("PRINT_c and PRINT_D:\n");
    Show(PRINT_C | PRINT_D);
    printf("PRINT all:\n");
    Show(PRINT_A | PRINT_B | PRINT_C | PRINT_D);
    return 0;
}
